package org.emergency.framework.model;

import java.io.Serializable;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.emergency.framework.constant.ModelConstant;

@Entity
@Table(name = "TB_DEPARTMENT_TB_USER", catalog = ModelConstant.DB_CATALOG)
public class TbUserDepartment implements Serializable {
	// Fields

	private TbDepartmentTbUserId id;
	private TbUser tbUser;
	private TbDepartment tbDepartment;
	// Constructors


	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "depsTbDepartmentId", column = @Column(name = "TB_DEPARTMENT_ID", nullable = false, length = 8)),
			@AttributeOverride(name = "usersTbUserId", column = @Column(name = "TB_USER_ID", nullable = false, length = 8)) })
	public TbDepartmentTbUserId getId() {
		return this.id;
	}

	public void setId(TbDepartmentTbUserId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TB_USER_ID", nullable = false, insertable = false, updatable = false)
	public TbUser getTbUser() {
		return this.tbUser;
	}

	public void setTbUser(TbUser tbUser) {
		this.tbUser = tbUser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TB_DEPARTMENT_ID", nullable = false, insertable = false, updatable = false)
	public TbDepartment getTbDepartment() {
		return this.tbDepartment;
	}

	public void setTbDepartment(TbDepartment tbDepartment) {
		this.tbDepartment = tbDepartment;
	}

}